Skip to content

🤖 fix: adopt @tanstack/oracles and close the memory redaction leaks its first oracle found - #8228

Merged
ThomasK33 merged 16 commits into
mainfrom
oracles-memory-redaction
Dec 5, 2026
Merged

ThomasK33 merged 16 commits into
mainfrom
oracles-memory-redaction

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Adopts @tanstack/oracles in Xum, starting with an oracle for the memory secret detector (src/node/services/memorySecretRedaction.ts). The oracle states six laws about what redactSecretLike, redactWithinCap, containsSecretLike and addsSecretLike promise, and checks them against an independent model with generated notes. It found six classes of leaks and false refusals, and this PR fixes them.

Background

The detector guards every memory write (memoryService.ts assertNoNewSecret) and redacts what the memory harvest quotes. Its unit tests pin examples, but the inputs are open-ended: any note, line order, lead character and JSON escaping. An oracle generates those inputs and judges each result against the law, and its gap check mutates the owned code to show which changes no law notices.

What the oracle found (fixed here)

The share is the measured share of generated inputs in each family that broke the law before the fix.

Rule broken Example Share
A nested YAML key leaked its value token: over api_key: X 15/65 combinations
In JSON-escaped text, a provider key, Bearer or JWT on a later line leaked "a\nsk-..." 7/20 shapes
A key that its own quotes wrap took the closing quote as its value, eating the text after it \"API_KEY=\" inside a JSON string 3–5/14 forms
A cookie value two JSON layers deep lost its closing quote \\\"Cookie: sid=S\\\" 7/9 frames
A note that quotes a key's marker was refused password=[redacted], API_KEY: [redacted] every unquoted key form
A key behind leading punctuation on the line under a key leaked (also on main) password= over (API_KEY: <value> found by CI's random seed
A cookie value ran past its line or its list's ] curl -H "Cookie: sid=S"; echo done, ["a=]b", "sid=S"] both shapes

Also tightened: a key pair on the line under a key (YAML's nested api_key:, or one behind punctuation such as (API_KEY:) is never the value of the key above, so its own value goes, while a key name glued into a value on the key's own line (password=hunter2_api_key:) is the value's text and goes with it, a key's own closing quote is not its value, and an unquoted value of Markdown structure or a placeholder alone (`, **, ~~, >, ...) is no value, while any other symbols are (password=!@#$%^). Each fix went oracle-first: the law failed on the old code, then passed after the fix. New unit tests also fail on the old code.

Implementation

  • Toolchain: @tanstack/oracles 0.0.1, @tanstack/eslint-plugin-oracles 0.0.1, fast-check 4.11.0, vitest 4.1.12, pinned. bunfig.toml exempts the two TanStack packages from the 7-day release wait; remove that after 2026-12-10.
  • Lint: the oracle presets in eslint.config.mjs, mirrored in .oxlintrc.json (the plugin is aliased to oracle, its rule prefix). oracle/no-oracle-disable cannot run in oxlint (its JS plugin API lacks getInlineConfigNodes), so check-oxlint-config.mjs lists it as an intentional gap.
  • Running: make test-oracles runs the oracles and the gap check (local, about 90 s). make check-oracles runs only the laws (about 5 s); CI runs it in Test / Unit shard 1, because the gap check exits 0 even when a law fails. vitest.oracle.config.mts joins the config path filter.
  • Agents: an "Oracle tests" block in AGENTS.md (the tool's template 4, condensed to the shorter style of 🤖 docs: halve agent-facing text, enforce its rules as checks, and fix the drift it hid #8233), and skill pointers in .agents/skills and .claude/skills that load the skills shipped in node_modules/@tanstack/oracles.
  • The oracle: tests/oracles/memorySecretRedaction.oracle.ts, six laws: secrets go, ordinary text stays, guards agree, a quoted marker is no credential, the cap shows only its own text, no throw. Laws 1–4 also hold on notes JSON-escaped once or twice.

Validation

  • Gap check: 665 mutants, 562 killed, 103 gaps (268 at the first full run). The guards-agree law now covers a renamed key that keeps its value (password=hunter2 to API_KEY: hunter2, accepted), which kills the change that would compare main's key read with its key. Remaining gaps: 68 in the cookie reader's list and quote paths (mostly code that no history reaches, since the regex pass redacts those values first), 18 in marker tails (non-ASCII letters, the ] scan), 14 in the ] tracking between passes, 3 in the cap.

  • Every unit test file that imports the detector or the memory service passes (2313 tests). The linear-time tests can miss their CPU ceiling on a loaded host; they pass on rerun, and timings match main.

  • CI runs the laws with a fresh random seed on each run, as the tool intends. That seed found two of the bugs here, one of them also on main (password= over (API_KEY: <value> leaked the value). A failure prints its seed and a replay line; when it also fails on main, it is not the PR's bug and should be filed, not block (the tool's own guidance).

Risks

Medium, limited to memory notes. Redaction keeps more text in one place: a quoted marker (password=[redacted]) is accepted when no letter or digit follows its closing quote. A key that ends its line still takes the next line's first word as its value, as on main, including a heading over prose (## Deploy token: over Rotate every password.). This PR first narrowed that read to keep prose readable, and three security-review rounds each found a credential that the narrower read left readable (password: over hunter2, then hunter2 # comment), so the read is main's again. For the same reason a key that ends a JSON string after other text ({"title": "## Deploy token:"}) takes the string's closing quote as its value's opening one, as on main: a quoted value may start with ,, } or ] ({"password": ", hunter2"}, which a guard for that case left readable in 48 of 60 probed forms). The guards refuse at least what main's guard refuses, by construction: they also count what main's key read and Bearer read take out (MAIN_READS), apart from the passes (Option B, chosen after four security reviews in a row found a credential that a rule leaving a key's value out let through). A differential fuzz of 400,000 texts and edits, cookie headers included, found no text or edit that main's guards refuse and these accept. The cost is main's: a note that leaves a value out behind its key's own quote (Set "API_KEY=" before deploy.) or behind Markdown (**Token:** rotate monthly.) is refused, and so is any edit below such a quote, whose read runs to the next quote in the text. The same holds for a marker that main's key read takes as a value: a quoted marker after a key ("password": "[redacted]", credential: "[redacted]", word) and a Bearer marker after a key (Authorization: Bearer [redacted]) are refused, as on main. Redaction still returns those lines unchanged. A cookie header's marker (Cookie: [redacted]) is refused too, as on main (Option A, third round): every rule that accepted it left a way to glue a value onto it behind its closing quote, which the shell joins onto the header. Every other change redacts more or refuses more.

Decisions and follow-ups

  • Kept as on main: a cookie header with no value (Set-Cookie: alone on a line) is still redacted and refused, and the guards refuse a cookie header's marker (Cookie: [redacted]) and a signed URL's marker alone (?sig=[redacted]). The guard refuses at least what main's regex passes refuse, and these refusals expose no secret. The oracle states both as limits.
  • Follow-up: a cookie header after other text inside a JSON string ("Send the Cookie:\nnext") has a raw frame, so its value runs to the end of the note. That loses text and never leaks. Fixing it needs the reader to track which string the header sits in.
  • Follow-up PR (decided on this PR, Option B): redaction leaves text that the shell joins onto a quoted cookie header readable: a word or a second quoted segment glued behind its closing quote (curl -H "Cookie: a=b",sid=<value>, curl -H "Cookie: a=b","<value>"). main does the same in raw and once-escaped text. In twice-escaped text main removes it only because its pattern cannot find the header's closing quote and reads to the end of the text; this PR finds that quote at every depth. The guards refuse such a line at every depth, because they count the header's value. The fix needs the cookie reader to tell a quote that closes a shell word from one that closes a JSON list item (["Cookie: a=b","Accept: */*"]), with its own oracle law (a shell argument's value runs to the end of its shell word).
  • Next: more oracles across the codebase.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $37.71

…ction

Adds the oracle toolchain (pinned packages, lint presets for ESLint and oxlint,
make test-oracles / check-oracles, agent skill pointers, AGENTS.md block) and
the first oracle, tests/oracles/memorySecretRedaction.oracle.ts, with six laws.
Fixes the leaks and false refusals the oracle found in memorySecretRedaction.ts.

---
_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$37.71`_
@mintlify

mintlify Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Mux 🟢 Ready View Preview Dec 4, 2026, 7:22 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T08:32:33.434988Z 431ce12 Manual request
🔒 Security Review ✅ Completed 2026-12-05T08:46:06.759497Z 431ce12 Manual request

Security findings

Advisory findings (13)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 07fff0db65

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

21 agent steps · 6 replayed from cache · 15 model calls · 47.7k tokens (23% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 1 step · 1 call 6.2s
🟢 a chat survives a restart of the server 1 step · 1 call 6.2s
🟢 compaction.e2e.ts · 1 passed 1 step · 1 call 4.4s
🟢 /compact replaces the old chat with a summary 1 step · 1 call 4.4s
🟢 pluginTrustRestart.e2e.ts · 1 passed 3 steps · 2 calls 10.1s
🟢 a trusted plugin hook stays trusted after the server restarts 3 steps · 2 calls 10.1s
🟢 settingsRoundTrip.e2e.ts · 1 passed 2 steps · 1 call 9.0s
🟢 a chat survives trips through Settings 2 steps · 1 call 9.0s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 4.5s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 4.5s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 4.3s
🟢 the agent opens the playground workspace 2 steps · 1 call 4.3s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 6.8s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 6.8s
🟢 todoNudge.e2e.ts · 1 passed 1 step · 1 call 3.0s
🟢 the agent finishes open TODO items after the turn-end nudge 1 step · 1 call 3.0s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 27.2s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 3.3s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 3.8s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.7s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 5.3s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 3.6s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 6.5s

e2e 0.20.0 · 1m 19s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 7.9k tokens (22% cached)
Spend: $0.02 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 5.2s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 5.2s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 6.1s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 6.1s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 5.2s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 5.2s

e2e 0.20.0 · 19.1s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 6.5s · 2 targets (web, phone) · run artifacts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 07fff0db65

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Codex security review: password: over hunter2 no longer lost hunter2.
A line of one word under a key that ends its line is the key's value again
(valueGapOf), as main reads it; a line with a blank in it stays text.
The oracle gains the shape and keeps ordinary one-word lines apart from keys.

---
_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$37.71`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 3030724487

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 3030724487

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Codex security review: password=!@#$%^ was no longer redacted. Only a value
of Markdown structure or a placeholder (*_~`>|.-) is no value now.
CI's random seed found a one-word line under a key that an earlier pass had
redacted ((Bearer X became [redacted]]); a word that holds a marker is no
next-line value. Oracle: symbol password shape, Bearer-after-paren history.

---
_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 06770d795f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 06770d795f

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Codex security review: password: over 'hunter2 # comment' leaked. Every
narrower read of the line under a key left a value readable, so the gap is
main's whitespace run again, and the guard refuses at least what main's
passes refuse. NOT_A_KEY also sees a key behind leading punctuation, which
the oracle's random seed found leaking on main ('password=' over
'(API_KEY: <value>').

---
_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 160643525d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 160643525d

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Codex security review: password="[redacted]"hunter2 passed both guards. A
quoted marker is the whole value only when no letter or digit follows its
closing quote. The oracle's random seed also found that the widened key
lookahead read a JSON-escaped line break as punctuation before the next
line's key, which left a symbol-only value readable; the lead run now stops
at a backslash.

---
_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 92d9c7c582

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 92d9c7c582

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

`password=hunter2_api_key:` stayed readable: the key pattern skipped a value
that looked like a nested key pair, and nothing after it took a value. A key
pair is now a nested value only when it starts a later line (YAML `token:`
over `  api_key: <value>`); on the key's own line the name is the value's
text, so the whole value goes. Bearer tokens follow the same rule.

The oracle's secrets-go law gains the shape that leaked; its hard-coded shape
indexes now look shapes up by name.

---
_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 45da4e4f43

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 45da4e4f43

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

A quoted value may start with what ends a JSON string, so the guard that
read such a quote as the string's close left `{"password": ", hunter2"}`
readable (48 of 60 probed forms). The guard is gone: a key that ends a
JSON string after other text takes the string's closing quote as its
value's opening one, as on main, which loses text and never leaks.

The ordinary-text law now writes a key at line end on a JSON-escaped
note's last line only when the note ends in a line break; the secrets-go
law gains a quoted value that starts with a JSON delimiter.

---
_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

Review loop paused again: the quoted-marker exemption is not converging.

The last two Codex security findings (#9 password="[redacted]"@%^+, fixed in a45aa94; #10 password="[redacted]",hunter2, open) both pass through one rule. The guards accept a value that is only a quoted marker, or a marker behind an auth scheme. main's guard refuses those notes: "password": "[redacted]", credential: "[redacted]", Authorization: Bearer [redacted]. So this exemption is the one place where Option B's rule ("refuse at least what main refuses") does not hold. Anything glued after the closing quote can continue a shell word (, does, in Bash), so each narrower end rule leaves another shape.

Open finding #10: password="[redacted]",hunter2 passes both guards on this branch, and main's guard refuses it.

Options:

  • Option A: make the end of a quoted marker depend on its context. After an unquoted key (shell, env), only a shell word end (blank, ;, &, |, ), line end) or a sentence end counts. After a quoted key (JSON, a Python dict), ,, } and ] count too. Quoted-marker notes stay writable, but more findings in this rule are likely.
  • Option B: drop the exemption for what main's reads take out. The guards then refuse a quoted marker after a key, and Bearer [redacted] after a key, as main does. Unquoted markers (password=[redacted], API_KEY: [redacted]), Cookie: [redacted] and postgres://[redacted]@host stay accepted, since main accepts them too or by decision. Redaction output does not change. This ends the class by construction. The cost: notes that quote redacted JSON or a redacted Authorization header are refused again, as on main, and the markers-stay law narrows to match.

Recommendation: Option B. It applies the rule you chose without the one exception I added. The refusal message already tells the writer to leave the value out.

Paused for a maintainer decision.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

The guards no longer exempt main's key and Bearer reads of a marker: a
quoted marker after a key (`"password": "[redacted]"`) and a Bearer
marker after a key (`Authorization: Bearer [redacted]`) are refused, as
main's guard refuses them. Redaction still returns those lines as they
are. Decision by Thomas Kosiewski on PR 8228 (Option B).

The marker law states the refusal, and a new history (tails moved, none
added) holds tails twice so the guards' repeat counts are judged.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

53cf3dc drops the guards' exemption for main's marker reads (Option B): a quoted marker after a key and a Bearer marker after a key are now refused, as on main. The marker oracle states it and gains a history that judges the guards' repeat counts.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 53cf3dcee0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 53cf3dcee0

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

# Conflicts:
#	docs/AGENTS.md
#	src/node/services/agentSkills/builtInSkillContent.generated.ts
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

31bf3b1 merges main (#8233 shrank AGENTS.md; the oracle block is condensed to its style). No change to the detector or the oracle since 53cf3dc.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 31bf3b1768

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 31bf3b1768

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

Status: Codex approved 31bf3b1 and its security review found nothing. No review thread is open, and every required check passes. The PR now needs an approving review from a maintainer before it can merge.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

An edit may now rename the key of an unquoted name=value or name: value
pair and keep its value as written (password=hunter2 to API_KEY:
hunter2). addsSecretLike owes false there: the same credential under
another key. Decision by Thomas Kosiewski on PR 8228 (Option A).

A probe of 576 renames (every pair key, line lead, letter and symbol
values, 0-2 JSON layers) found every one accepted. The gap that no law
covered (main's key read comparing the key with its value) is now
killed. Production is unchanged.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

9b6253c widens the guards-agree law (Option A): an edit may rename the key of an unquoted pair and keep its value, and addsSecretLike owes false there. A probe of 576 renames found every one accepted. Production is unchanged.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 9b6253c502

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 9b6253c502

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Both guards accept a cookie header's marker (Cookie: [redacted]), by
decision on this PR. The cookie reader ends the header's value at a
quote that a comma, colon or bracket follows, so in
curl -H "Cookie: [redacted]",sid=<value> the shell joins the word onto
the header and both guards still accepted it (Codex security review).

A word glued behind the quote that closes a cookie header's marker is
now a tail, read like the key and signed-URL tails: it counts when a
letter or digit stands in it, and it ends where a shell word ends (a
blank, a quote, a backslash, a shell operator or a backtick). The
marker law gains the form and a history that copies such a tail; it
failed on the unfixed code (containsSecretLike false) and passes now.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

026a398 fixes the security finding on cookie markers: a word glued behind the quote that closes a cookie header's marker ("Cookie: [redacted]",sid=<value>) is now a tail, refused by both guards. The marker oracle gained the form; it failed before the fix and passes now.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 026a3982ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 026a3982ef

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

Pausing the review loop: it is not converging in one area.

Codex security findings #5 to #12 are all ways to glue a value onto a quoted marker that the guards accept: glued after a key's quote, after a comma, and now (#12) a second quoted shell segment after a cookie header's marker (curl -H "Cookie: [redacted]","sid=<value>", refused by main's guard and accepted here). Each fix added a rule for one more way to glue text on, and the next round found another. More rules will not end the series. The way out is to drop the exemption for a cookie header's marker and refuse it, as main does. That needs the maintainer's decision, because the exemption was his decision. The thread for #12 stays open until then.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Both guards accepted a cookie header's marker (Cookie: [redacted]),
and every rule that told a quoted marker apart from a value glued onto
it left another way through: a word behind its closing quote (fixed
in 026a398), then a second quoted segment, which the shell joins onto
the header (curl -H "Cookie: [redacted]","sid=<value>"). Decision by
Thomas Kosiewski on PR 8228 (Option A): drop the exemption.

The guards now count the marker that the cookie pattern takes out and
writes back, as main's do: containsSecretLike is true for a note that
holds one, and addsSecretLike refuses an edit that holds more of them.
Redaction still returns such a line unchanged. The tail rule for a word
glued behind a cookie marker's quote has no job left and is gone.

The marker law states the rule (a cookie header that starts with the
marker holds one copy of it, the same in every header) and gains
histories that swap one header's marker or tail for another's. It
failed on the unfixed code and passes now. A differential fuzz of
400,000 texts and edits against main, cookie headers included, found
no text or edit that main's guards refuse and these accept.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

431ce12 drops the exemption for a cookie header's marker (Option A): both guards count the marker that the cookie pattern takes out and writes back, as main's do, so Cookie: [redacted] is refused whatever follows it. The rule from 026a398 is gone. A differential fuzz against main, cookie headers included, found no text or edit that main refuses and these accept.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 431ce12ece

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 431ce12ece

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

Pausing again on the Codex security finding about shell-joined cookie segments in doubly escaped output (curl -H "Cookie: sid=prefix","<value>").

main leaves <value> readable too in raw and once-escaped text. In twice-escaped text main removes it only because its cookie pattern cannot find the header's closing quote there, so it reads to the end of the text and also deletes what is no cookie (a following -d "..." argument, the rest of the output). This PR finds that quote at every depth, so all three depths now behave alike. A real fix needs the cookie reader to tell a quote that closes a shell word from one that closes a JSON list item (["Cookie: sid=x","Accept: */*"] reads the same). That is the area where the last eight findings did not converge, so the maintainer decides whether it lands here or in a follow-up. The write guards refuse the header in all three depths. The thread stays open until then.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

@ThomasK33
ThomasK33 merged commit f3c1e50 into main Dec 5, 2026
91 of 94 checks passed
@ThomasK33
ThomasK33 deleted the oracles-memory-redaction branch December 5, 2026 09:57
ThomasK33 added a commit that referenced this pull request Dec 5, 2026
## Summary

Memory redaction now treats a cookie header in a shell argument (`curl
-H "Cookie: ..."`) as running to the end of its shell word. A word or a
quoted segment glued behind the header's closing quote is part of the
same argument, so it is redacted too. Examples are `-H "Cookie:
sid=a",tok=VALUE` and `-H "Cookie: sid=a","tok=VALUE"`. Before this
change, that glued value reached the memory harvest in clear text.

## Background

Codex raised this on #8228 (finding 13). We deferred it to this
follow-up, with the rule chosen on that PR (Option B): a shell
argument's value ends where its shell word ends, while a header string
in JSON or a list keeps the item after it.

## Implementation

All changes are in `src/node/services/memorySecretRedaction.ts`:

- A quote opens a **shell argument** when blanks behind a word come
right before it (`-H "`, `echo '`). Behind `[`, `{`, `,`, `:` or `=` it
still opens a JSON or list item, whose closing quote ends the value. So
`["Cookie: a","Accept: */*"]` keeps `"Accept: */*"`.
- After a shell argument's closing quote, `shellValueEnd` extends the
value through the glued shell word (`readShellWord`). It does this only
when a `,`, `]`, `}` or `:` comes right after the close and the glued
text holds a letter or digit. Punctuation alone (`"Cookie: sid=x", then
...` in prose) holds no value, so the close stays.
- The shell word reads a quoted segment whole and goes on after it. It
takes `\'` as a literal quote, not a segment. It ends at a blank, a tab,
an operator, a backtick or the end of its line. In an escaped command (a
JSON string that holds the command line), it also ends at an escaped
line break or at the close of that JSON string. A `'` is content there:
it opens a segment and does not close the string.
- A quoted segment that never closes ends at the end of its line, as the
header's value does, so it cannot take the lines after it.

## Validation

- Oracle `tests/oracles/memorySecretRedaction.oracle.ts`:
- 14 new shapes. Ten shell forms must go, among them a quoted segment, a
single-quoted segment, `\'`, a tab, an unclosed segment, the end of a
line and a command in a JSON string. A prose comma behind the close must
stay, two JSON header lists must keep their next item, and a JSON cookie
key at the end of its line must keep its closing quote.
  - A new ordinary line holds a header name with no `:`.
- Three constructed histories write the shell forms raw and JSON-escaped
once and twice, so the fixed seed reaches every one.
  - The law and authority text name the shell argument.
- Result: **RED** on `main` (33 of 206 tests fail), **GREEN** here (206
pass).
- Gap check (`make test-oracles`): **96 gaps, all already open on
`main`** (103 gaps there; this branch closes 7 of them). Every mutant in
the new functions is killed. While closing those gaps, the oracle found
a second leak, now fixed: in a JSON-escaped command, a `'` after the
header's close was read as the close of the JSON string, so `,'x VALUE'`
stayed readable.
- Unit tests: `memorySecretRedaction.test.ts` covers the shell forms raw
and JSON-escaped, the unclosed segment, the JSON items that stay, and
the guards. `memoryToolText.test.ts` adds the Codex repro:
`renderToolValue` of a tool result whose stdout holds the curl line, raw
or JSON-escaped. It fails on `main` and passes here. The `memoryService`
and `memoryConsolidation` tests pass.
- `make static-check` passes except `lint-hadolint`, which is not
installed on this host; this PR changes no Dockerfile. ESLint, `make
crap-check` and `make dry-check` pass.

## Risks

- A shell argument can now lose more text than before: everything glued
behind its closing quote, up to the end of the shell word. This happens
only when the quote follows blanks behind a word, and a `,`, `]`, `}` or
`:` comes right after the close.
- A redacted shell word drops the header's closing quote (`curl -H
"Cookie: [redacted] https://...`), because that quote was inside the
redacted word.
- A quoted segment that spans lines in the shell is read only to the end
of its line, so text on its later lines stays readable. This matches how
the header's value already ends at its line.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`high` • Cost: `$96.27`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high
costs=96.27 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant